<?php session_start();
//  Developed by Roshan Bhattarai 
//  Visit http://roshanbh.com.np for this script and more.
//  This notice MUST stay intact for legal use

// if session is not set redirect the user
if(empty($_SESSION['u_name']))
	header("Location:index.php");	

//if logout then destroy the session and redirect the user
if(isset($_GET['logout']))
{
	session_destroy();
	header("Location:index.php?logout=true");
}	
?>
<?php
$path = "http://".$_SERVER["HTTP_HOST"]."/gibbons";
?>
<?php
include 'includes/header.php';
?>
<table cellpadding="0" cellspacing="0" width="100%" border="0" >
<tr>
<td colspan="2">
<?php
$str = "<a href='home.php?logout' style='text-align:right;'><b>Logout<b></a>";
echo "<div align='right'>Welcome ".$_SESSION['name'].", ".$str."</div>";
?>
</td>
</tr>
<tr>
<td width="15%" valign="top">
<?php
include 'includes/menu.php';
?>
</td>
<td valign="top">
<div id="tabs">

<?php
include 'includes/tabs.php';

if(isset($_REQUEST['id']))
{
	if($_REQUEST['id'] != "")
	{
		//ENGINE
		
		$sqlE = "SELECT * FROM tbl_engine WHERE vehicleid=".$_REQUEST['id'];
		$resultE = mysql_query($sqlE);
		$qryE = mysql_fetch_array($resultE);
		
		//CHASIS
		$sqlC = "SELECT * FROM tbl_chasis WHERE vehicleid=".$_REQUEST['id'];
		$resultC = mysql_query($sqlC);
		$qryC = mysql_fetch_array($resultC);
		
		$sqlD = "SELECT * FROM tbl_dimension_capabilities WHERE vehicleid=".$_REQUEST['id'];
		$resultD = mysql_query($sqlD);
		$qryD = mysql_fetch_array($resultD);
		
		
		$sqlD = "SELECT * FROM tbl_drivetrain WHERE vehicleid=".$_REQUEST['id'];
		$resultD = mysql_query($sqlD);
		$qryDC = mysql_fetch_array($resultD);
		
		$sqlG = "SELECT * FROM tbl_general WHERE vehicleid=".$_REQUEST['id'];
		$resultG = mysql_query($sqlG);
		$qryG = mysql_fetch_array($resultG);
		
	}	
}


?>
<script>
$("#tab4").addClass( "ui-tabs-selected ui-state-active" );
</script>
<form id="form1" name="form1" action="">

<div style="padding-left:30px;">
<table cellpadding="0" cellspacing="0" width="80%">
<tr>
<td valign="top">


<table>

<tr>
<td colspan="2">
<b><u>Engine</u></b>
</td>
</tr>
<tr>
<td>
Engine Type
</td>
<td>
<input type="text" name="txtEngineType" id="txtEngineType" value="<?php  print stripslashes($qryE["enginetype"]); ?>" >
</td>
</tr>

<tr>
<td>
Displacement
</td>
<td>
<input type="text" name="txtDisplacement" id="txtDisplacement" value="<?php  print stripslashes($qryE["displacement"]); ?>" >
</td>
</tr>

<tr>
<td>
Bore x Stroke
</td>
<td>
<input type="text" name="txtBoreStroke" id="txtBoreStroke" value="<?php  print stripslashes($qryE["borestroke"]); ?>" >
</td>
</tr>

<tr>
<td>
Cylinders
</td>
<td>
<input type="text" name="txtCylinders" id="txtCylinders" value="<?php  print stripslashes($qryE["cylinders"]); ?>" >
</td>
</tr>

<tr>
<td>
Engine Cooling
</td>
<td>
<input type="text" name="txtEngineCooling" id="txtEngineCooling" value="<?php  print stripslashes($qryE["enginecooling"]); ?>" >
</td>
</tr>

<tr>
<td>
Fuel System
</td>
<td>
<input type="text" name="txtFuelSystem" id="txtFuelSystem" value="<?php  print stripslashes($qryE["fuelsystem"]); ?>" >
</td>
</tr>

<tr>
<td>
Starting System
</td>
<td>
<input type="text" name="txtStartingSystem" id="txtStartingSystem" value="<?php  print stripslashes($qryE["startingsystem"]); ?>" >
</td>
</tr>

<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>

<tr>
<td colspan="2">
<b><u>Chassis</u></b>
</td>
</tr>
<tr>
<td>
Front Suspension
</td>
<td>
<input type="text" name="txtFrontSuspension" id="txtFrontSuspension" value="<?php  print stripslashes($qryC["frontsuspension"]); ?>" >
</td>
</tr>

<tr>
<td>
Front Travel
</td>
<td>
<input type="text" name="txtFrontTravel" id="txtFrontTravel" value="<?php  print stripslashes($qryC["fronttravel"]); ?>" >
</td>
</tr>

<tr>
<td>
Front Brake Type
</td>
<td>
<input type="text" name="txtFrontBrakeType" id="txtFrontBrakeType" value="<?php  print stripslashes($qryC["frontbraketype"]); ?>" >
</td>
</tr>

<tr>
<td>
Front Tires
</td>
<td>
<input type="text" name="txtFrontTires" id="txtFrontTires" value="<?php  print stripslashes($qryC["fronttires"]); ?>" >
</td>
</tr>

<tr>
<td>
Rear Suspension
</td>
<td>
<input type="text" name="txtRearSuspension" id="txtRearSuspension" value="<?php  print stripslashes($qryC["rearsuspension"]); ?>"  >
</td>
</tr>

<tr>
<td>
Rear Travel
</td>
<td>
<input type="text" name="txtRearTravel" id="txtRearTravel" value="<?php  print stripslashes($qryC["reartravel"]); ?>"  >
</td>
</tr>

<tr>
<td>
Rear Brake Type
</td>
<td>
<input type="text" name="txtRearBrakeType" id="txtRearBrakeType"  value="<?php  print stripslashes($qryC["rearbraketype"]); ?>"  >
</td>
</tr>

<tr>
<td>
Rear Tires
</td>
<td>
<input type="text" name="txtRearTires" id="txtRearTires" value="<?php  print stripslashes($qryC["reartires"]); ?>"  >
</td>
</tr>

<tr>
<td>
Frame
</td>
<td>
<input type="text" name="txtFrame" id="txtFrame" value="<?php  print stripslashes($qryC["frame"]); ?>"  >
</td>
</tr>
</table>


</td>
<td align="right">

<table>
<tr>
<td colspan="2">
<b><u>Dimensions/Capacities</u></b>
</td>
</tr>
<tr>
<td>
Dry Weight
</td>
<td>
<input type="text" name="txtDryWeight" id="txtDryWeight"  value="<?php  print stripslashes($qryD["dryweight"]); ?>" > 
</td>
</tr>

<tr>
<td>
Front Rack Capacity
</td>
<td>
<input type="text" name="txtFrontRackCapacity" id="txtFrontRackCapacity" value="<?php  print stripslashes($qryD["frontrackcapacity"]); ?>" >
</td>
</tr>

<tr>
<td>
Rear Rack Capacity
</td>
<td>
<input type="text" name="txtRearRackCapacity" id="txtRearRackCapacity"  value="<?php  print stripslashes($qryD["rearrackcapacity"]); ?>" >
</td>
</tr>

<tr>
<td>
Towing Capacity
</td>
<td>
<input type="text" name="txtTowingCapacity" id="txtTowingCapacity" value="<?php  print stripslashes($qryD["towingcapacity"]); ?>" >
</td>
</tr>

<tr>
<td>
Fuel Capacity
</td>
<td>
<input type="text" name="txtFuelCapacity" id="txtFuelCapacity" value="<?php  print stripslashes($qryD["fuelcapacity"]); ?>" >
</td>
</tr>

<tr>
<td>
Ground Clearance
</td>
<td>
<input type="text" name="txtGroundClearance" id="txtGroundClearance" value="<?php  print stripslashes($qryD["groundclearance"]); ?>" >
</td>
</tr>

<tr>
<td>
Machine Dimensions (LxWxH)
</td>
<td>
<input type="text" name="txtMachineDimensions" id="txtMachineDimensions" value="<?php  print stripslashes($qryD["machinedimension"]); ?>" >
</td>
</tr>

<tr>
<td>
Wheelbase
</td>
<td>
<input type="text" name="txtWheelbase" id="txtWheelbase" value="<?php  print stripslashes($qryD["wheelbase"]); ?>" >
</td>
</tr>

<tr>
<td colspan="2">
&nbsp;
</td>
</tr>

<tr>
<td colspan="2">
<b><u>Drive Train</u></b>
</td>
</tr>
<tr>
<td>
Drive Train
</td>
<td>
<input type="text" name="txtDriveTrain" id="txtDriveTrain"  value="<?php  print stripslashes($qryDC["drivetrain"]); ?>" >
</td>
</tr>

<tr>
<td>
Final Drive
</td>
<td>
<input type="text" name="txtFinalDrive" id="txtFinalDrive" value="<?php  print stripslashes($qryDC["finaldrive"]); ?>" >
</td>
</tr>

<tr>
<td>
Transmission
</td>
<td>
<input type="text" name="txtTransmission" id="txtTransmission" value="<?php  print stripslashes($qryDC["transmission"]); ?>" >
</td>
</tr>


<tr>
<td colspan="2">
&nbsp;
</td>
</tr>

<tr>
<td colspan="2">
<b><u>General</u></b>
</td>
</tr>
<tr>
<td>
Speedometer
</td>
<td>
<input type="text" name="txtSpeedometer" id="txtSpeedometer"  value="<?php  print stripslashes($qryG["speedmeter"]); ?>" >
</td>
</tr>

<tr>
<td>
Tachometer
</td>
<td>
<input type="text" name="txtTachometer" id="txtTachometer" value="<?php  print stripslashes($qryG["techometer"]); ?>"  >
</td>
</tr>

<tr>
<td>
Odometer
</td>
<td>
<input type="text" name="txtOdometer" id="txtOdometer" value="<?php  print stripslashes($qryG["odometer"]); ?>"  >
</td>
</tr>

<tr>
<td>
Lighting
</td>
<td>
<input type="text" name="txtLighting" id="txtLighting" value="<?php  print stripslashes($qryG["lighting"]); ?>" >
</td>
</tr>

<tr>
<td>
Colors
</td>
<td>
<input type="text" name="txtColors" id="txtColors"  value="<?php  print stripslashes($qryG["colors"]); ?>"  >
</td>
</tr>

<tr>
<td>
Warranty
</td>
<td>
<input type="text" name="txtWarranty" id="txtWarranty"  value="<?php  print stripslashes($qryG["warranty"]); ?>"  >
</td>
</tr>
</table>
</td>
</tr>

<tr>
<td align="right" colspan="2">
<input type="button" name="submit" id="submit" class="submit" value="submit" onclick="saveSpecifications('<?php print $path; ?>');" >	
</td>
<tr>
</table>
</div>
</form>

</div>
</td>
</tr>
</table>
<?php
include 'includes/footer.php';
?>